package com.cqjtu.store.order.pojo.vo;

import io.swagger.models.auth.In;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @ProjectName: cqjtu-store
 * @Titile: OrderVO
 * @Author: Lucky
 * @Description: 订单VO
 */
@Data
public class OrderVO {
    private Integer id;
    private String recvName;
    private String recvPhone;
    private String recvAddress;
    private Date orderTime;
    private Integer status;
    private Integer isDelete;
    /*订单总价*/
    private Integer totalPrice;
    /*一个订单下有多个订单项 =>1:N*/
    private List<OrderItemVO> orderItemVOList;

    public Integer getTotalPrice(){
        totalPrice = 0;
        orderItemVOList.forEach(orderItemVO -> {
            totalPrice += orderItemVO.getTotal();
        });
        return this.totalPrice;
    }
}
